<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once APP_ROOT . 'library/smarty/Smarty.class.php';

class SmartyView extends Smarty {
	
	private $_smarty;
	
	public function __construct() {
		/* 初始化  */
		$this->_smarty = new Smarty();
		$this->_smarty->setTemplateDir(APP_ROOT . 'templates/');
		$this->_smarty->setCompileDir(APP_ROOT . 'data/smarty/templates_c/');
		$this->_smarty->setCacheDir(APP_ROOT . 'data/smarty/cache/');
		$this->_smarty->left_delimiter = '{#';
		$this->_smarty->right_delimiter = '#}';
		$this->_smarty->addPluginsDir(APP_ROOT . 'data/smarty/plugins/');
	}
	
	public function getSmarty() {
		return $this->_smarty;
	}
	
	public function assign($key, $value, $noCache = false) {
		$this->_smarty->assign($key, $value, $noCache);
	}
	
	public function display($telName) {
		$this->_smarty->display($telName);
	}
}
